﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace Tilver.Coder.Core
{
    /// <summary>
    /// 参数
    /// </summary>
    [Serializable]
    public class CoderParameter : CoderDataObject, ICloneable
    {
        /// <summary>
        /// 类型
        /// </summary>
        public override DataObjectTypeEnum DataType
        {
            get { return DataObjectTypeEnum.Parameter; }
        }
        /// <summary>
        /// 参数值
        /// </summary>
        public string Value { get; set; }
        /// <summary>
        /// 参数输出类型
        /// </summary>
        public ParameterDirection Direction { get; set; }
        /// <summary>
        /// 构造方法
        /// </summary>
        public CoderParameter()
        {
            Direction = ParameterDirection.Input;
        }

        #region ICloneable 成员

        /// <summary>
        /// 复制
        /// </summary>
        /// <returns></returns>
        public object Clone()
        {
            return new CoderParameter
            {
                Name = this.Name,
                CodeName = this.CodeName,
                DbType = this.DbType,
                CSharpType = this.CSharpType,
                NativeType = this.NativeType,
                IsEnumType = this.IsEnumType,
                AllowGenerateEnum = this.AllowGenerateEnum,
                AllowDBNull = this.AllowDBNull,
                Precision = this.Precision,
                Scale = this.Scale,
                Size = this.Size,
                DefaultValue = this.DefaultValue,
                Description = this.Description,
                State = this.State
            };
        }

        #endregion
    }
}
